#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:装饰器的使用.py
# author: 马国鑫
# datetime:2022/3/18 21:14
# software: PyCharm

"""
this is function  description 
"""

# import module your need
# 使用装饰器计算函数运行时间
import time


def func_out(func):
    def func_in():
        # func存储的是test函数
        start = time.time()
        func()
        end = time.time()
        take_time = end - start
        print("代码运行一共耗费了:", take_time)

    return func_in


# 被装饰的函数，只要被func_out装饰就可以计算该函数的调用时间
# test = func_out(test)
@func_out
def test():
    for i in range(10000):
        print(i)


test()
